package com.lfz.search.vo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ResponseResult {

    public static final int STATUS_SUCCEED = 200;
    public static final int STATUS_UNAUTHORIZED = 401;
    public static final int STATUS_PARAMETER_ERROR = 400;
    public static final int STATUS_PERMISSION_DENIED = 403;
    public static final int STATUS_SERVER_ERROR = 500;

    public static final Map<Integer, String> MESSAGES;

    static {
        MESSAGES = new HashMap<>();
        MESSAGES.put(STATUS_SUCCEED, "OK");
        MESSAGES.put(STATUS_UNAUTHORIZED, "未登陆");
        MESSAGES.put(STATUS_PARAMETER_ERROR, "参数错误");
        MESSAGES.put(STATUS_PERMISSION_DENIED, "权限不足");
        MESSAGES.put(STATUS_SERVER_ERROR, "服务器错误");
    }

    private Integer status;
    private String message;

    private Map<String, String> keyWords;

    private List<? extends Object> data;

    private Long totalCount;
    private Integer currentPage;
    private Integer pageSize;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        if (message == null) {
            return MESSAGES.get(status);
        }
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Map<String, String> getKeyWords() {
        return keyWords;
    }

    public void setKeyWords(Map<String, String> keyWords) {
        this.keyWords = keyWords;
    }

    public List<? extends Object> getData() {
        return data;
    }

    public void setData(List<? extends Object> data) {
        this.data = data;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public int getBegin(){
        return (currentPage-1) * pageSize;
    }

}